package cn.itcast.hotel.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author by xiaoHu
 * @Date 2023/2/2 17:22
 * @Description 配置类
 */
@Configuration
public class EsConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient(EsProperties esproperties){
       return new RestHighLevelClient(RestClient.builder(new HttpHost(esproperties.getHost(),
               esproperties.getPort())));
    }
}
